<template>
  <div class="dashboard-editor-container">
    <div class="container-box">
      <div class="header">
        <span class="title">签协议和合同就业毕业生的单位行业分布</span>
        <YearRangePicker @get-year-range="getYearRange" class="year-picker" />
      </div>
      <mainchart
        ref="myChart4"
        :myStart="start"
        :myEnd="end"
        :myType="type"
        :key="timer"
      />
      <tabledata
        :myStart="start"
        :myEnd="end"
        :key="timer"
        style="margin-top: 80px"
      />
    </div>
  </div>
</template>

<script>
import tabledata from "./components/tabledata.vue";
import mainchart from "./components/mainchart.vue";
import YearRangePicker from "../../components/yearRangePicker.vue";

export default {
  components: {
    tabledata,
    mainchart,
    YearRangePicker,
  },
  data() {
    return {
      timer: "",
      type: 1,
      start: null,
      end: null,
    };
  },
  mounted() {
    window.onresize = () => {
      this.$refs.myChart4.resize();
    };
  },
  methods: {
    handleClick(tab, event) {
      //repaint the component
      this.timer = new Date().getTime();
      //get tab value
      if (tab.props.name == "first") {
        //benkesheng
        this.type = 1;
      } else {
        this.type = 2;
      }
    },
    getYearRange(start, end) {
      this.timer = new Date().getTime();
      this.start = start;
      this.end = end;
    },
  },
};
</script>

<style scoped>
.dashboard-editor-container {
  /* padding: 32px; */
  background-color: rgb(240, 242, 245);
  position: relative;
}

.container-box {
  width: 90%;
  margin: 0 auto;
  background: #fff;
  padding-bottom: 100px;
  padding-top: 30px;
}

.main-chart {
  width: 70%;
  margin: 0 auto;
}

.header {
  width: 80%;
  margin: 0 auto;
  display: -webkit-flex; /* Safari */
  display: flex;
  flex-direction: row; /* 水平方向 */
  flex-wrap: wrap; /* 超出换行 */
  justify-content: space-between;
}

.title {
  padding-top: 20px;
  font-size: 32px;
  color: black;
  font-weight: 600;
}

.year-picker {
  width: 300px;
  margin-top: 18px;
  display: inline-block;
}
</style>
